package Leetcode;

import java.util.HashSet;
import java.util.Set;

public class Leetcode_96 {
    public static int repeatedNTimes(int[] nums) {
        Set<Integer> found = new HashSet<Integer>();
        for (int num : nums) {
            if (!found.add(num)) {
                return num;
            }
        }
        // 不可能的情况
        return -1;
    }

    public static void main(String[] args) {
        int[] nums = {1,2,3,3};
        System.out.println(repeatedNTimes(nums));
    }
}
